<template>
  <el-table
    :data="tableData"
    border
    style="width: 100%">
    <el-table-column
      prop="role_name"
      label="姓名"
      width="180">
    </el-table-column>
    <el-table-column
      prop="email"
      label="邮箱"
      width="180">
    </el-table-column>
    <el-table-column
      prop="mobile"
      label="电话">
    </el-table-column>
  </el-table>
</template>

<script>
  export default {
    data() {
      return {
        tableData: []
      }
    },
    created(){
        this.initData();
    },
    methods:{
        initData(){
            var that = this;
            this.$http.get('users',{
                params:{
                    query:'',
                    pagenum:1,
                    pagesize:4
                }
            }).then(function(res){
                // 因为axios会帮我们封装一层，所以我们要先，解构赋值
                var { data } = res;
                that.tableData = data.data.users;
            })
        }
    }
  }
</script>

<style>

</style>